package com.weixing.mall.provider.controller.admin;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.annotation.NoRepeatSubmit;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.core.support.auth.SysAuth;
import com.weixing.mall.core.support.auth.SysInfo;
import com.weixing.mall.provider.model.dto.GoodsTransBillOperationDto;
import com.weixing.mall.provider.service.IGoodsTransBillOperationService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName AdminGoodsTransBillOperationController
 * @Description TODO <br/>
 * @Author gjq
 * @Modified By:
 * @Date 2019/10/29
 * @Version 1.0
 **/
@RequestMapping("goodsTransBillOperation")
@RestController
@Api(value = "调货单操作记录Api",tags = "调货单操作记录")
public class GoodsTransBillOperationController extends BaseController {

    @Autowired
    private IGoodsTransBillOperationService goodsTransBillOperationService;

    @ApiOperation(value = "根据调货单id查找操作记录")
    @GetMapping("getOperationByTransBillId/{transBillId}")
    public Result getOperationByTransBillId(@PathVariable Long transBillId){
        return ResultUtil.success(goodsTransBillOperationService.getOperationByTransBillId(transBillId));
    }

    @ApiOperation(value = "保存调货单操作记录")
    @PostMapping("save")
    @NoRepeatSubmit
    public Result save(@SysInfo SysAuth auth, GoodsTransBillOperationDto goodsTransBillOperationDto){
        goodsTransBillOperationService.create(goodsTransBillOperationDto,auth.getUid());
        return ResultUtil.success();
    }
}
